﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyCoreLib.Automation.Data.SqlClient.Model
{
    public sealed class ContractFieldInfo
    {
        public readonly string Name;

        public readonly string Description;

        public readonly string Type;

        public ContractFieldInfo(IOutput output, IContractField field)
        {
            if (ReferenceEquals(field, null))
            {
                throw new ArgumentNullException("field");
            }

            if (string.IsNullOrWhiteSpace(field.Name))
            {
                throw new NotImplementedException();
            }

            if (string.IsNullOrWhiteSpace(field.Type))
            {
                throw new NotImplementedException();
            }

            Name = field.Name.Trim();
            Type = string.IsNullOrWhiteSpace(field.Type) ? "object" : field.Type.Trim();
            Description = string.IsNullOrWhiteSpace(field.Description)
                ? this.Name
                : field.Description.Trim();
        }
    }
}
